﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace bts_webapp
{
    public partial class ViewMessage : BasePage
    {
        public void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
           
        }

        public void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            var q = (from f in this.DbContext.VIBA_FILEs
                    join u in this.DbContext.VIBA_Users
                        on f.File_From equals u.User_Id
                    where f.Status == 1 && f.File_To.ToLower() == Common.CurrentUser.User_Id.ToLower()
                    select new TempViewMessage()
                    {
                        File_From = f.File_From,
                        File_FromName = u.User_Full_Name,
                        File_Name = f.File_Name,
                        File_Description = f.File_Description,
                        SentDate = f.SentDate.Value
                    }).ToList();

            this.RadGrid1.DataSource = q;
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public class TempViewMessage
        {
            public string File_From { get; set; }
            public string File_FromName { get; set; }
            public string File_Name { get; set; }
            public string File_Description { get; set; }
            public DateTime SentDate { get; set; }

        }
    }
}